#include <stdio.h>
//形参数组arr在本质上是指针
int sum(int *arr, int n) {
    int s = 0;
    int *rear = arr + n - 1;
    for (; arr <= rear; arr++)
        s = s + (*arr);
    return (s);
}

//数组名b是常量
int main(void) {
    int *rear;
    int b[5] = {1, 4, 5, 7, 9};
//    rear = b + 4;
//    for (; b <= rear; b++)  //b = b+1;
//        sum = sum + (*b);
//    printf("%d\n", sum);
    printf("%d\n", sum(b, 5));
    return 0;
}
